<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8">
        <title>新增页面</title>
        <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
        <link rel="stylesheet" href="/app/admin/component/jsoneditor/css/jsoneditor.css" />
        <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
    </head>
    <body>

        <form class="layui-form" action="">

            <div class="mainBox">
                <div class="main-container mr-5">
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">mall_id</label>
                        <div class="layui-input-block">
                            <input type="number" name="mall_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">mch_id</label>
                        <div class="layui-input-block">
                            <input type="number" name="mch_id" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">副标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="subtitle" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">场景分类</label>
                        <div class="layui-input-block">
                            <input type="number" name="scenic_type_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">景点分类</label>
                        <div class="layui-input-block">
                            <input type="number" name="scenic_category_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">主图</label>
                        <div class="layui-input-block">
                            <input type="text" name="image" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">轮播图</label>
                        <div class="layui-input-block">
                            <textarea name="list_images" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">视频介绍地址</label>
                        <div class="layui-input-block">
                            <textarea name="videourl" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">景区地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="address" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">客服电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="tel" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">特色说明</label>
                        <div class="layui-input-block">
                            <textarea name="feature_content" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">费用说明</label>
                        <div class="layui-input-block">
                            <textarea name="cost_content" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">预定说明</label>
                        <div class="layui-input-block">
                            <textarea name="reserve_content" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">景点介绍</label>
                        <div class="layui-input-block">
                            <textarea name="describe_content" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">经度</label>
                        <div class="layui-input-block">
                            <input type="text" name="lon" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">维度</label>
                        <div class="layui-input-block">
                            <input type="text" name="lat" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">状态:0=禁止,1=启用</label>
                        <div class="layui-input-block">
                            <div name="status" id="status" value="" ></div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">权重</label>
                        <div class="layui-input-block">
                            <input type="number" name="sort" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">开放时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="open_time" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">关闭时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="close_time" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">景区最低价</label>
                        <div class="layui-input-block">
                            <input type="number" name="price" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">搜索关键词</label>
                        <div class="layui-input-block">
                            <input type="text" name="keywords" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否开放:0=禁止,1=开放</label>
                        <div class="layui-input-block">
                            <div name="is_open" id="is_open" value="" ></div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">外部链接</label>
                        <div class="layui-input-block">
                            <input type="text" name="outer_url" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">喜爱度</label>
                        <div class="layui-input-block">
                            <input type="number" name="love" value="5" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">view</label>
                        <div class="layui-input-block">
                            <input type="number" name="view" value="1" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">第三方景点id</label>
                        <div class="layui-input-block">
                            <input type="text" name="third_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">第三方服务商编码</label>
                        <div class="layui-input-block">
                            <input type="text" name="third_supplier_code" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">区域编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="region_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">省</label>
                        <div class="layui-input-block">
                            <input type="number" name="province_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">市</label>
                        <div class="layui-input-block">
                            <input type="number" name="city_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">区</label>
                        <div class="layui-input-block">
                            <input type="number" name="area_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否分时段</label>
                        <div class="layui-input-block">
                            <input type="number" name="is_time_stock" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">分时段配置json</label>
                        <div class="layui-input-block">
                            <textarea name="times_list" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">景区导览链接</label>
                        <div class="layui-input-block">
                            <textarea name="tour_url" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">额外链接</label>
                        <div class="layui-input-block">
                            <textarea name="second_tour_url" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">VR全景链接</label>
                        <div class="layui-input-block">
                            <textarea name="vr_url" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">展示标签</label>
                        <div class="layui-input-block">
                            <input type="text" name="scenic_new_tag" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="create_time" id="create_time" value="CURRENT_TIMESTAMP" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">更新时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="update_time" id="update_time" value="CURRENT_TIMESTAMP" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否精选 1:是 0:否</label>
                        <div class="layui-input-block">
                            <div name="is_hot" id="is_hot" value="0" ></div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否参与一卡通:0=不参与,1=参与</label>
                        <div class="layui-input-block">
                            <div name="is_onecard" id="is_onecard" value="0" ></div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">一卡通介绍</label>
                        <div class="layui-input-block">
                            <textarea name="onecard_content" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    
                </div>
            </div>

            <div class="bottom">
                <div class="button-container">
                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit=""
                        lay-filter="save">
                        提交
                    </button>
                    <button type="reset" class="pear-btn pear-btn-md">
                        重置
                    </button>
                </div>
            </div>
            
        </form>

        <script src="/app/admin/component/layui/layui.js?v=2.8.12"></script>
        <script src="/app/admin/component/pear/pear.js"></script>
        <script src="/app/admin/component/jsoneditor/jsoneditor.js"></script>
        <script src="/app/admin/admin/js/permission.js"></script>
        
        <script>

            // 相关接口
            const INSERT_API = "/app/admin/tejian-scenic/insert";
            
            // 字段 状态:0=禁止,1=启用 status
            layui.use(["jquery", "xmSelect"], function() {
                let value = layui.$("#status").attr("value");
                let initValue = value ? value.split(",") : [];
                layui.xmSelect.render({
                    el: "#status",
                    name: "status",
                    filterable: true,
                    initValue: initValue,
                    model: {"icon":"hidden","label":{"type":"text"}},
                    clickClose: true,
                    radio: true,
                })
            });
            
            // 字段 是否开放:0=禁止,1=开放 is_open
            layui.use(["jquery", "xmSelect"], function() {
                let value = layui.$("#is_open").attr("value");
                let initValue = value ? value.split(",") : [];
                layui.xmSelect.render({
                    el: "#is_open",
                    name: "is_open",
                    filterable: true,
                    initValue: initValue,
                    model: {"icon":"hidden","label":{"type":"text"}},
                    clickClose: true,
                    radio: true,
                })
            });
            
            // 字段 创建时间 create_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#create_time",
                    type: "datetime",
                });
            })
            
            // 字段 更新时间 update_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#update_time",
                    type: "datetime",
                });
            })
            
            // 字段 是否精选 1:是 0:否 is_hot
            layui.use(["jquery", "xmSelect"], function() {
                let value = layui.$("#is_hot").attr("value");
                let initValue = value ? value.split(",") : [];
                layui.xmSelect.render({
                    el: "#is_hot",
                    name: "is_hot",
                    filterable: true,
                    initValue: initValue,
                    value: "0",
                    model: {"icon":"hidden","label":{"type":"text"}},
                    clickClose: true,
                    radio: true,
                })
            });
            
            // 字段 是否参与一卡通:0=不参与,1=参与 is_onecard
            layui.use(["jquery", "xmSelect"], function() {
                let value = layui.$("#is_onecard").attr("value");
                let initValue = value ? value.split(",") : [];
                layui.xmSelect.render({
                    el: "#is_onecard",
                    name: "is_onecard",
                    filterable: true,
                    initValue: initValue,
                    value: "0",
                    model: {"icon":"hidden","label":{"type":"text"}},
                    clickClose: true,
                    radio: true,
                })
            });
            
            //提交事件
            layui.use(["form", "popup"], function () {
                // 字段验证允许为空
                layui.form.verify({
                    phone: [/(^$)|^1\d{10}$/, "请输入正确的手机号"],
                    email: [/(^$)|^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, "邮箱格式不正确"],
                    url: [/(^$)|(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, "链接格式不正确"],
                    number: [/(^$)|^\d+$/,'只能填写数字'],
                    date: [/(^$)|^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/, "日期格式不正确"],
                    identity: [/(^$)|(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "请输入正确的身份证号"]
                });
                layui.form.on("submit(save)", function (data) {
                    layui.$.ajax({
                        url: INSERT_API,
                        type: "POST",
                        dateType: "json",
                        data: data.field,
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功", function () {
                                parent.refreshTable();
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                            });
                        }
                    });
                    return false;
                });
            });

        </script>

    </body>
</html>
